package clases;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

public class Persistencia 
{
	public static Padron deserializar()
	{
		Padron p = null;
		try
		{	
			FileInputStream  fis = new FileInputStream("miPadron.txt");
			ObjectInputStream ois = new ObjectInputStream(fis);
			p = (Padron) ois.readObject();
			ois.close();
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
			p = new Padron();
		}
		return p;
	}	


	public static void serializar(Padron padron)
	{
		try 
		{
			FileOutputStream fos = new FileOutputStream("miPadron.txt");
			ObjectOutputStream oos = new ObjectOutputStream(fos);
			oos.writeObject(padron);
			oos.close();
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}